package com.totoro.mybatis.mul_datasource_dynamic.config;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * 动态数据源
 * Created by Niki on 2018/8/16 9:33
 */
public class DynamicDataSource extends AbstractRoutingDataSource {
    @Override
    protected Object determineCurrentLookupKey() {
        System.out.println("数据源为："+DataSourceContextHolder.getDB());
        return DataSourceContextHolder.getDB();
    }
}
